import request from '@/utils/request'

// 查询地区列表
export function listDistrict(query) {
  return request({
    url: '/system/district/list',
    method: 'get',
    params: query
  })
}

// 异步查询地区列表
export function asynchronousDistrictList(query) {
  return request({
    url: '/system/district/asynchronous/district/' + query,
    method: 'get'
  })
}

// 地区编码查询地区名称
export function selectOrgCodeName(query) {
  return request({
    url: '/system/district/district/orgcode/name',
    method: 'post',
    data: query
  })
}

// 获取地区树型结构
export function getDistrictTreeList() {
  return request({
    url: '/system/district/tree/district',
    method: 'get'
  })
}

// 查询 角色 地区
export function  userLevelDistrict(roleId) {
  return request({
    url: '/system/district/role/district/' + roleId,
    method: 'get'
  })
}

// 查询地区详细
export function getDistrict(code) {
  return request({
    url: '/system/district/' + code,
    method: 'get'
  })
}

// 新增地区
export function addDistrict(data) {
  return request({
    url: '/system/district',
    method: 'post',
    data: data
  })
}

// 修改地区
export function updateDistrict(data) {
  return request({
    url: '/system/district',
    method: 'put',
    data: data
  })
}

// 删除地区
export function delDistrict(code) {
  return request({
    url: '/system/district/' + code,
    method: 'delete'
  })
}
